Fix broken unit tests in time-planning-pn components #1122
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Fixed two failing unit tests in the time-planning-pn plugin components that were preventing the CI/CD pipeline from passing.
Issues Fixed
1. AssignedSiteDialogComponent Test Expectations
The test
should copy break settings from global settings for monday
was failing because it expected numeric minute values, but the implementation converts these to time strings.The Problem:
The Fix:
Updated test expectations to match the actual converted string format:
480
minutes →"08:00"
30
minutes →"00:30"
60
minutes →"01:00"
2. DownloadExcelDialogComponent RxJS Error
The
onDownloadExcelReportAllWorkers
andonDownloadExcelReport
methods were usingcatchError
incorrectly, causing the error:The Problem:
The Fix:
EMPTY
from rxjscatchError
to returnEMPTY
(a valid empty observable)caught
toerror
for clarityTest Results
All 119 tests in the time-planning-pn module now pass:
The console warnings about navigation in jsdom are expected browser API limitations in the test environment and do not affect test functionality.
Original prompt
This section details on the original issue you should resolve
<issue_title>Fix broken unit tests</issue_title>
<issue_description>```
FAIL src/app/plugins/modules/time-planning-pn/components/plannings/time-planning-actions/assigned-site/assigned-site-dialog.component.spec.ts (30.226 s)
● AssignedSiteDialogComponent › Break Settings › should copy break settings from global settings for monday
FAIL src/app/plugins/modules/time-planning-pn/components/plannings/time-planning-actions/download-excel/download-excel-dialog.component.spec.ts (7.579 s)
● Console
Fixes #1121
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.